package com.example.springboot_code_read.condition;

import com.example.springboot_code_read.annotation.MyAnnotation;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class MyOnClassCondition implements Condition {

    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {

        metadata.getAnnotations().forEach(x -> System.out.println(x.getType()));

        return metadata.isAnnotated(MyAnnotation.class.getName());

    }

}
